// Licensed to Elasticsearch B.V under one or more agreements.
// Elasticsearch B.V licenses this file to you under the Apache 2.0 License.
// See the LICENSE file in the project root for more information.
//
// ███╗   ██╗ ██████╗ ████████╗██╗ ██████╗███████╗
// ████╗  ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝
// ██╔██╗ ██║██║   ██║   ██║   ██║██║     █████╗
// ██║╚██╗██║██║   ██║   ██║   ██║██║     ██╔══╝
// ██║ ╚████║╚██████╔╝   ██║   ██║╚██████╗███████╗
// ╚═╝  ╚═══╝ ╚═════╝    ╚═╝   ╚═╝ ╚═════╝╚══════╝
// ------------------------------------------------
//
// This file is automatically generated.
// Please do not edit these files manually.
//
// ------------------------------------------------

using Elastic.Transport;
using System;
using System.Collections.Generic;
using System.Linq.Expressions;
using System.Text.Json;
using System.Text.Json.Serialization;

#nullable restore
namespace Elastic.Clients.Elasticsearch.Ml
{
	public sealed class MlPutCalendarRequestParameters : RequestParameters<MlPutCalendarRequestParameters>
	{
	}

	public sealed partial class MlPutCalendarRequest : PlainRequestBase<MlPutCalendarRequestParameters>
	{
		public MlPutCalendarRequest(Elastic.Clients.Elasticsearch.Id calendar_id) : base(r => r.Required("calendar_id", calendar_id))
		{
		}

		internal override ApiUrls ApiUrls => ApiUrlsLookups.MachineLearningPutCalendar;
		protected override HttpMethod HttpMethod => HttpMethod.PUT;
		protected override bool SupportsBody => true;
		[JsonInclude]
		[JsonPropertyName("job_ids")]
		public IEnumerable<Elastic.Clients.Elasticsearch.Id>? JobIds { get; set; }

		[JsonInclude]
		[JsonPropertyName("description")]
		public string? Description { get; set; }
	}

	public sealed partial class MlPutCalendarRequestDescriptor : RequestDescriptorBase<MlPutCalendarRequestDescriptor, MlPutCalendarRequestParameters>
	{
		internal MlPutCalendarRequestDescriptor(Action<MlPutCalendarRequestDescriptor> configure) => configure.Invoke(this);
		public MlPutCalendarRequestDescriptor(Elastic.Clients.Elasticsearch.Id calendar_id) : base(r => r.Required("calendar_id", calendar_id))
		{
		}

		internal MlPutCalendarRequestDescriptor()
		{
		}

		internal override ApiUrls ApiUrls => ApiUrlsLookups.MachineLearningPutCalendar;
		protected override HttpMethod HttpMethod => HttpMethod.PUT;
		protected override bool SupportsBody => true;
		public MlPutCalendarRequestDescriptor CalendarId(Elastic.Clients.Elasticsearch.Id calendar_id)
		{
			RouteValues.Required("calendar_id", calendar_id);
			return Self;
		}

		private string? DescriptionValue { get; set; }

		private IEnumerable<Elastic.Clients.Elasticsearch.Id>? JobIdsValue { get; set; }

		public MlPutCalendarRequestDescriptor Description(string? description)
		{
			DescriptionValue = description;
			return Self;
		}

		public MlPutCalendarRequestDescriptor JobIds(IEnumerable<Elastic.Clients.Elasticsearch.Id>? jobIds)
		{
			JobIdsValue = jobIds;
			return Self;
		}

		protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings)
		{
			writer.WriteStartObject();
			if (!string.IsNullOrEmpty(DescriptionValue))
			{
				writer.WritePropertyName("description");
				writer.WriteStringValue(DescriptionValue);
			}

			if (JobIdsValue is not null)
			{
				writer.WritePropertyName("job_ids");
				JsonSerializer.Serialize(writer, JobIdsValue, options);
			}

			writer.WriteEndObject();
		}
	}
}